package com.atguigu.gmall.realtime.app.demo;

import org.apache.flink.api.common.eventtime.WatermarkStrategy;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

public class FlinkCdcDemo {

    public static void main(String[] args) throws Exception {

/*
        //1 环境
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        env.enableCheckpointing(3000);
        //2  flinkcdc的数据源定义
        MySqlSource<String> mySqlSource = MySqlSource.<String>builder()
                .hostname("hadoop102")
                .port(3306)
                .databaseList("gmall_realtime_config") // set captured database
                .tableList("gmall_realtime_config.customer") // set captured table
                .username("root")
                .password("000000")
                .deserializer(new JsonDebeziumDeserializationSchema()) // converts SourceRecord to JSON String
                .startupOptions(StartupOptions.initial())//initial 默认项 ，会把采集分为两个阶段 1 采集当前全量快照 jdbc，2 跟踪最新的变化  binlog
                .build();


        //3 flinkcdc数据源加载为流

        DataStreamSource<String> cdcStream = env.fromSource(mySqlSource, WatermarkStrategy.noWatermarks(), "mysql_source");


        //4 打印
        cdcStream.print();

        env.execute();


*/

    }

}
